

$(function () {

    solidWasteTypeLoadSuccess();

    loadDisposeMethodData();

    loadOutsourcingUnit();

    loadExportingCountry();


    loadDetailsUnitDisposeList();
    loadDetailsEntrustDisposeList();
    loadDetailsExitDisposeList();
});

/**
 * 加载内部处理表格
 */
function  loadDetailsUnitDisposeList() {
    var swaId=$('#swaId').val();
    var url=findUnitDisposeBySwaId+swaId;

    $('#unitDisposeList').datagrid({
        url:url,
        method:'get',
        title:'处理方式-单位内部设施处置利用',
        fitColumns:true,
        // rownumbers:true,
        singleSelect:true,
        striped:true,
        fit:true,
        columns:[[

            {field:'startDate',title:'处理开始日期',width:10,
                editor:{
                    type:'datebox',
                    options: {
                        editable: false,
                        required: true
                    }
                }
            },
            {field:'endDate',title:'处理结束日期',width:10,
                editor:{
                    type:'datebox',
                    options: {
                        editable: false,
                        required: true
                    }
                }
            },
            {field:'method',title:'处理方法',width:10,
                editor:{
                    type:'combobox',
                    options: {
                        required: true,
                        editable: false,
                        valueField:'id',
                        textField:'text',
                        data:disposeData
                    }
                },
                formatter:disposeMethodFormatter
            },
            {field:'number',title:'处理数量',width:10,
                editor:{
                    type:'numberspinner',
                    options: {
                        required: true,
                        precision:2,
                        min:0
                    }
                }
            }
        ]],
        toolbar: '#unitDisposeToolbar',
        onEndEdit:getDisposeNumber
    });
}
/**
 * 加载外委单位处理表格
 */
function  loadDetailsEntrustDisposeList() {
    var swaId=$('#swaId').val();
    var url=findEntrustDisposeBySwaId+swaId;
    $('#entrustDisposeList').datagrid({
        url:url,
        title:'处理方式-提供或委托处理利用',
        fitColumns:true,
        // rownumbers:true,
        singleSelect:true,
        striped:true,
        fit:true,
        columns:[[

            {field:'startDate',title:'处理开始日期',width:10,
                editor:{
                    type:'datebox',
                    options: {
                        editable: false,
                        required: true
                    }
                }
            },
            {field:'endDate',title:'处理结束日期',width:10,
                editor:{
                    type:'datebox',
                    options: {
                        editable: false,
                        required: true
                    }
                }
            },
            {field:'outsourcingUnitId',title:'外委单位',width:10,
                editor:{
                    type:'combobox',
                    options: {
                        required: true,
                        editable: false,
                        valueField:'id',
                        textField:'text',
                        data:outsourcingUnitData
                    }
                },
                formatter:outsourcingUnitFormatter
            },
            {field:'number',title:'处理数量',width:10,
                editor:{
                    type:'numberspinner',
                    options: {
                        required: true,
                        precision:2,
                        min:0
                    }
                }
            }
        ]],
        toolbar: '#entrustDisposeToolbar',
        onEndEdit:getDisposeNumber
    });
}
/**
 * 加载出口处理表格
 */
function  loadDetailsExitDisposeList() {
    var swaId=$('#swaId').val();
    var url=findExitDisposeBySwaId+swaId;
    $('#exitDisposeList').datagrid({
        url:url,
        title:'处理方式-出口',
        fitColumns:true,
        // rownumbers:true,
        singleSelect:true,
        striped:true,
        fit:true,
        columns:[[

            {field:'startDate',title:'处理日期',width:10,
                editor:{
                    type:'datebox',
                    options: {
                        editable: false,
                        required: true
                    }
                }
            },
            {field:'exportingCountry',title:'出口国',width:10,
                editor:{
                    type:'combobox',
                    options: {
                        required: true,
                        editable: false,
                        valueField:'id',
                        textField:'text',
                        data:exportingCountryData
                    }
                },
                formatter:exportingCountryFormatter
            },
            {field:'number',title:'出口数量',width:10,
                editor:{
                    type:'numberspinner',
                    options: {
                        required: true,
                        precision:2,
                        min:0
                    }
                }
            }
        ]],
        toolbar: '#exitDisposeToolbar',
        onEndEdit:getDisposeNumber
    });
}